﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="frmThreadPosts.aspx.cs" Inherits="WCrawler.frmThreadPosts" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="ajaxToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <h2>Thread Posts</h2>
        <p>
            <asp:Button ID="btnCheckThreadPosts" runat="server" 
                onclick="btnCheckThreadPosts_Click" Text="Check Thread Posts" />
        </p>
    <asp:UpdatePanel ID="ForumThreadPanel" runat="server">
    <ContentTemplate>
    <asp:GridView ID="gridViewThreadPosts" runat="server" 
        AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
        DataKeyNames="ForumThreadId,PostDetailsId" DataSourceID="ThreadPostLinqDataSource" 
        ForeColor="#333333" 
        Width="100%" GridLines="Both" 
        onrowdatabound="gridViewThreadPosts_RowDataBound">
        <EmptyDataTemplate>
            <asp:Label ID="lblEmptySearch0" runat="server" Font-Bold="True" 
                ForeColor="#0033CC">No Results Found....  
                </asp:Label>
        </EmptyDataTemplate>
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
            <asp:TemplateField HeaderText="#" ItemStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <asp:Label ID="lblNum0" Runat="server" />
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Forum" SortExpression="Forum">
                <ItemTemplate>
                    <asp:HyperLink ID="hyperLinkForum" runat="server" 
                        NavigateUrl='<%#Eval("ForumThread.Forum.ForumUrl") + "/" + Eval("ForumThread.Forum.DefaultUrl") %>' 
                        Text='<%#Eval("ForumThread.Forum.ForumUrl") %>'> </asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="ThreadNum" SortExpression="ThreadNum">
                <ItemTemplate>
                    <asp:Label ID="lblThreadNum" runat="server" Text='<%#Eval("ForumThread.ThreadNum") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="txtThreadNum" runat="server" Text='<%#Bind("ForumThread.ThreadNum") %>'></asp:TextBox>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="PostNum" SortExpression="PostNum">
                <ItemTemplate>
                    <asp:Label ID="lblPostNum" runat="server" Text='<%#Eval("PostNum") %>'> </asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="txtPostNum" runat="server" Text='<%#Bind("PostNum") %>'></asp:TextBox>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Thread" SortExpression="Topic">
                <ItemTemplate>
                    <asp:HyperLink ID="hyperLinkThread" runat="server" 
                        NavigateUrl='<%#Eval("ForumThread.Forum.ForumUrl") + "/" + Eval("ForumThread.ThreadUrl") %>' 
                        Text='<%#Eval("ForumThread.ThreadTitle") %>'> </asp:HyperLink>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="txtPostUrl" runat="server" Text='<%#Bind("PostNum") %>'></asp:TextBox>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Replies" SortExpression="Replies">
                <ItemTemplate>
                    <asp:Label ID="lblReplies" runat="server" Text='<%#Bind("ForumThread.Replies") %>'> </asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Views" SortExpression="Views">
                <ItemTemplate>
                    <asp:Label ID="lblViews" runat="server" Text='<%#Bind("ForumThread.Views") %>'> </asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="CreateOn" HeaderText="CreateOn" 
                SortExpression="CreateOn" />
            <asp:BoundField DataField="UpdateOn" HeaderText="UpdateOn" 
                SortExpression="UpdateOn" />
        </Columns>
        <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
        <PagerSettings Mode="NumericFirstLast" />
        <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
        <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
        <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
        <SortedAscendingCellStyle BackColor="#FDF5AC" />
        <SortedAscendingHeaderStyle BackColor="#4D0000" />
        <SortedDescendingCellStyle BackColor="#FCF6C0" />
        <SortedDescendingHeaderStyle BackColor="#820000" />
    </asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
    
    

    <asp:LinqDataSource ID="ThreadPostLinqDataSource" runat="server" 
        ContextTypeName="WCrawlerLib.LinqDataClassesDataContext" EntityTypeName="" 
        TableName="ThreadPosts" onselecting="ThreadPostLinqDataSource_Selecting" 
        EnableDelete="True" EnableUpdate="True">
    </asp:LinqDataSource>
</asp:Content>
